#!/bin/bash


make

cd rel && rm -rf ham_server.zip && cd ..

cd rel && ../rebar generate -f && rm -f ham_server/etc/sys.config && cd ..

cd rel/ham_server && rm -rf etc/apns.pem && rm -rf etc/maintain.pem 

cp ../files/waimai_dev_maintain.pem etc/maintain.pem

cp ../files/waimain_dev_consumer.pem etc/apns.pem

cd ../..

cd rel && cp files/sys.config.formal ham_server/etc/sys.config && zip  -r ham_server.zip ham_server && cd ..

scp rel/ham_server.zip root@IM_SERVER_FORMAL:/opt/etcloud/

ssh root@IM_SERVER_FORMAL '/opt/etcloud/install.sh ham_server'

